#include "Packet.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
PACKET_HEADER *PACKET_HEADER_new() {
	return (PACKET_HEADER *) calloc(1, sizeof(PACKET_HEADER));
}
PACKET_HEADER *PACKET_HEADER_init(unsigned long protocol,
		unsigned long msgType, unsigned long dataLength) {
	PACKET_HEADER *instance = PACKET_HEADER_new();
	instance->protocol = protocol;
	instance->msgType = msgType;
	instance->dataLength = dataLength;
	return instance;
}
PACKET_DATA *PACKET_DATA_new() {
	return (PACKET_DATA *) calloc(1, sizeof(PACKET_DATA));
}
PACKET *PACKET_new() {
	return (PACKET *) calloc(1, sizeof(PACKET));
}
PACKET *PACKET_init(PACKET_HEADER *head, PACKET_DATA *data) {
	PACKET *packet = PACKET_new();
	packet->header = head;
	packet->data = data;
	return packet;
}
PACKET_DATA *MSG_REGISTER_MEMBER_PROFILE_init(char *message) {
	MSG_REGISTER_MEMBER_PROFILE *data =
			(MSG_REGISTER_MEMBER_PROFILE *) PACKET_DATA_new();
	memcpy(data->name, message, 16);
	memcpy(data->years, message + 16, 16);
	memcpy(data->language, message + 32, 16);
	memcpy(data->prize, message + 48, 16);
	memcpy(data->preferences, message + 64, 16);
	memcpy(data->phoneNumber, message + 80, 16);
	return (PACKET_DATA *) data;
}
PACKET_DATA *MSG_REQUEST_RESULT_init(char *message){
	MSG_REQUEST_RESULT *data =
			(MSG_REQUEST_RESULT *) PACKET_DATA_new();
	memcpy(data->result,message,16);
}
